Ext.define('DCApp.view.img.Detail', {
    extend: 'DCApp.view.Detail',
    alias: 'widget.imgdetail',
    
    requires: [
       'Ext.form.Panel',
       'Ext.form.field.Text',
       'Ext.form.field.TextArea',
       'Ext.layout.container.VBox',
       'Ext.layout.container.Anchor',
       'Ext.form.field.ComboBox',
       'Ext.view.View',
       'DCApp.Cfg'
    ],
    
    bind: {
        title: '影像 - 【{theImg.imageId}】'
    },
    
    componentCls: 'img-detail',
    bodyPadding: 0,
    
    controller: 'imgdetail',
    viewModel: {
        type: 'imgdetail'
    },
    
    tbar: ['->',{
        text: '上一条',
        handler: 'onPrev'
    },{
        text: '下一条',
        handler: 'onNext'
    },{
        text: '保存',
        handler: 'onSaveClick'
    },{
        text: '返回',
        handler: 'onBackClick'
    }],
    
    items: [{
        id:'panel0',
    	listeners: {
		  render: function(p){
			p = p.getEl();
			var me= this.up();
			me.h0=p.getHeight();
		    p.on('scroll', function(e, t){
		    	//console.log(t.scrollTop +"   "+ t.clientHeight);
		    	me.onscroll(t.scrollTop,t.clientHeight);
		    }, p);
		  }
		},
    	title: 'Panel 0',
        flex: 2,
        frame: false,
        xtype: 'container',
        layout: 'anchor',
        style: {
            overflow: 'auto'
        },
        items: [
                {
                    title: '影像信息',
                    margin: '0 0 10 0',
                    cls:'nav_pos',
                    bodyPadding: 10,
                    fieldDefaults: {
                        labelAlign: 'right',
                        labelWidth: 100,
                        padding:3
                    },
                    defaults: {
                        anchor: '100%'
                    },
                    xtype: 'form',
                    reference: 'form',
                    items: [{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '影像序号',
                            xtype: 'displayfield',
                			bind : '{theImg.imageId}'
                        }, {
                            flex: 2,
                            fieldLabel: '影像名称',
                            xtype: 'textfield',
                			bind : '{theImg.imageName}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '对象编号',
                            xtype: 'textfield',
                			bind : '{theImg.objNo}'
                        }, {
                            flex: 2,
                            fieldLabel: '对象名称',
                            xtype: 'textfield',
                			bind : '{theImg.objName}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '类型',
                			bind : '{theImg.imgType}',
                            emptyText: '影像类型',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('image_imgType'),
                            allowBlank: false
                       }, {
                            flex: 2,
                            fieldLabel: '颜色',
                			bind : '{theImg.imageSource}',
                            emptyText: '影像来源',
                            xtype: 'combobox',
                            queryMode: 'local',
                            valueField: 'abbr',
                            displayField: 'name',
                            store: DCApp.Cfg.getStore('image_imageSource'),
                            allowBlank: false
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '光盘卷标',
                            xtype: 'textfield',
                			bind : '{theImg.cdlabel}'
                        }, {
                            flex: 2,
                            fieldLabel: '文件名',
                            xtype: 'textfield',
                			bind : '{theImg.imgFile}'
                        }]
                    },{
                    	xtype: 'displayfield',
                    	bind: '{theImg.imageId}',
                    	//publishes: ['value'],
                    	fieldLabel: '影像说明',   
                    	height:200,
                    	renderer:function(v,d){
        		        	var uri = v % 5+'.jpg'; 
        		        	if(uri==""||uri==null){
        		        	    img_src="../imgs/no-photo-available.jpg";  
        		        	}else{
        		        		img_src='../imgs/'+uri;
        		        	}        			  	
        				    return	"<img style='max-width:200px;max-height:200px;'  src='"+img_src+"'>\"";
                    	}
                       },{
                    	xtype: 'htmleditor',
                    	bind: '{theImg.description}',
                    	publishes: ['value'],
                    	fieldLabel: '影像说明'                    		                    		
                       }]
                },{

                    title: '登记信息',
                    margin: '0 0 10 0',
                    cls:'nav_pos',
                    bodyPadding: 10,
                    fieldDefaults: {
                        labelAlign: 'right',
                        labelWidth: 100,
                        padding:3
                    },
                    defaults: {
                        anchor: '100%'
                    },
                    xtype: 'form',
                    items: [{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '存放路径',
                            xtype: 'displayfield',
                			bind : '{theImg.cdNo}'
                        }, {
                            flex: 2,
                            fieldLabel: '作者',
                            xtype: 'displayfield',
                			bind : '{theImg.photographer}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '影像提供单位',
                            xtype: 'textfield',
                			bind : '{theImg.provider}'
                        }, {
                            flex: 2,
                            fieldLabel: '扫描文件后缀',
                            xtype: 'textfield',
                			bind : '{theImg.scanSuffix}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '登记人',
                            xtype: 'textfield',
                			bind : '{theImg.registerMan}'
                        }, {
                            flex: 2,
                            fieldLabel: '登记时间',
                            xtype: 'textfield',
                			bind : '{theImg.registerTime}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '登记提交接受人',
                            xtype: 'textfield',
                			bind : '{theImg.regCReceiver}'
                        }, {
                            flex: 2,
                            fieldLabel: '登记提交时间',
                            xtype: 'textfield',
                			bind : '{theImg.regCTime}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '扫描者',
                            xtype: 'textfield',
                			bind : '{theImg.scanMan}'
                        }, {
                            flex: 2,
                            fieldLabel: '扫描时间',
                            xtype: 'textfield',
                			bind : '{theImg.scanTime}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '扫描提交接收人',
                            xtype: 'textfield',
                			bind : '{theImg.scanReceiver}'
                        }, {
                            flex: 2,
                            fieldLabel: '扫描提交时间',
                            xtype: 'textfield',
                			bind : '{theImg.scanCTime}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '影像加工者',
                            xtype: 'textfield',
                			bind : '{theImg.handler}'
                        }, {
                            flex: 2,
                            fieldLabel: '加工时间',
                            xtype: 'textfield',
                			bind : '{theImg.handleTime}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '图像文件后缀',
                            xtype: 'textfield',
                			bind : '{theImg.suffix}'
                        }, {
                            flex: 2,
                            fieldLabel: '加工提交时间',
                            xtype: 'textfield',
                			bind : '{theImg.handleCTime}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '有小图像',
                            xtype: 'checkbox',
                			bind : '{theImg.haveSmall}'
                        }, {
                            flex: 2,
                            fieldLabel: '有中图像',
                            xtype: 'checkbox',
                			bind : '{theImg.haveBigimage}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '中图像的宽',
                            xtype: 'textfield',
                			bind : '{theImg.mimgWidth}'
                        }, {
                            flex: 2,
                            fieldLabel: '中图像的高',
                            xtype: 'textfield',
                			bind : '{theImg.mimgHeight}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '有大图像',
                            xtype: 'checkbox',
                			bind : '{theImg.isLivepicture}'
                        }, {
                            flex: 2,
                            fieldLabel: '影像确认结果',
                            xtype: 'checkbox',
                			bind : '{theImg.confirmFlag}'
                        }]
                    },{
                        xtype: 'container',
                        layout: 'hbox',
                        combineErrors: true,
                        defaultType: 'textfield',
                        items: [{
                            flex: 2,
                            fieldLabel: '影像确认人',
                            xtype: 'textfield',
                			bind : '{theImg.confirmMan}'
                        }, {
                            flex: 2,
                            fieldLabel: '影像确认时间',
                            xtype: 'textfield',
                			bind : '{theImg.confirmTime}'
                        }]
                    }]
                                	
                }
            ]
        }]
});
